home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1997
/
MacHack 1997.toast
/
Hacks
/
Hacks ’96
/
HyperHack - Allan Bonadio
/
HyperHack.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1996-06-22
|
1KB
|
58 lines
#include <Resources.h>
#include <Fonts.h>
#include <Dialogs.h>
void
main()
{
DialogTemplate **dlog;
Handle ditl;
unsigned char curname[100];
short id, ity;
short itemhit;
unsigned long t;
DialogPtr dwin;
Rect r;
Handle ihandle;
InitGraf(&qd.thePort);
InitFonts();
FlushEvents( everyEvent, 0);
InitWindows();
InitMenus();
TEInit();
InitDialogs(0);
// start up and get the DLOG so we can munge it
OpenResFile("\pht");
dlog = (DialogTemplate **) GetResource('DLOG', 128);
while (1)
{
// set it to the one we want
ditl = GetNamedResource('DITL', curname);
if (ditl)
GetResInfo(ditl, &id, &t, curname);
else
id = 128;
(*dlog)->itemsID = id;
// Run the dialog
dwin = GetNewDialog(128, NULL, (WindowPtr) -1);
ModalDialog((ModalFilterUPP) 0, &itemhit);
// Get the name of the next item
GetDialogItem(dwin, itemhit, &ity, &ihandle, &r);
if (ity == kButtonDialogItem)
GetControlTitle((ControlRef) ihandle, curname);
else if (ity == kPictureDialogItem)
GetResInfo(ihandle, &id, &t, curname);
// go around again
DisposeDialog(dwin);
}
}